package com.kylin.log.web;


import com.kylin.log.dto.LogDto;
import com.kylin.log.entity.PageImpl;
import com.kylin.log.service.LogService;
import com.kylin.common.result.ResEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/log")
public class LogController {


    @Autowired
    LogService logService;

    @RequestMapping(method = RequestMethod.GET)
    public ResEntity get(LogDto logDto){
        if (logDto.getPageSize()==null){
            return ResEntity.error("请输入每页显示多少条");
        }
        if (logDto.getPageNo()==null){
            return ResEntity.error("请输入当前页数");
        }
        PageImpl log = logService.findLog(logDto);
        return ResEntity.ok(log);
    }
}
